#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSharedPointer>

#include <QtGui>

namespace Ui {
    class MainWindow;
}

#include <optra/common/proxy.h>
#include <optra/zoneinfo.h>
#include <QSystemTrayIcon>

class ApplicationsManager;
class TasksManager;
class ZonesManager;
class ProxyImpl;
class CustomProxy;
class WindowHolderUi;

class MainWindow : public QMainWindow {
    Q_OBJECT
public:

    typedef QSharedPointer<Optra::Proxy> ProxyPtr;


    MainWindow(QWidget *parent = 0);
    ~MainWindow();


protected:
    void changeEvent(QEvent *e);
    void closeEvent(QCloseEvent*e);
    void resizeEvent(QResizeEvent *e);

public slots:
    void zonesInitialized();

    void showToolWindow(QAction * a);
    void showViewWindow(QAction * a);
    void view(const QString& id);

    void tool(const QString& id);
private:    

    Ui::MainWindow *ui;    
    ProxyPtr proxy_;

    QSharedPointer<ApplicationsManager> apps;
    QSharedPointer<ZonesManager> zones;
    QSharedPointer<TasksManager> tasks;

    QList<Optra::ZoneWindow*> tools_;

    QSystemTrayIcon * tray_;

    friend class ProxyImpl;
    friend class OptraZone;
};

//static Proxy* proxy;

#endif // MAINWINDOW_H
